package com.oritsh.visitsys.controller;

import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.oritsh.visitsys.service.UserService;
import com.oritsh.visitsys.model.User;

@Controller
@RequestMapping("/user.do")
public class UserController {
	
	private UserService userService;
	@RequestMapping(params = "method=add")
	public String add(User user){
		System.out.println("name:"+user.getName());
		System.out.println("office:"+user.getOffice());
		userService.add(user);
		return "success";
	}
	@RequestMapping(params = "method=update")
	public String update(User user) {
		userService.update(user);
		return "success";
	}
	public UserService getBookService() {
		return userService;
	}
	@Resource
	public void setUserService(UserService userService) {
		this.userService = userService;
	}
}
